using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;
using Utility;
namespace BUS
{
   public class tbCTdiadanhtourBUS
    {
        public static void Insert(tbChitietdiadanhtour ctt)
        {
            tbChitietdiadanhtourDAL ctDAL = new tbChitietdiadanhtourDAL();
            ctDAL.Insert(ctt);
        }
        public static void Update(tbChitietdiadanhtour ctt)
        {
            tbChitietdiadanhtourDAL ctDAL = new tbChitietdiadanhtourDAL();
            ctDAL.Update(ctt);
        }
        public static void Delete(int iD)
        {
            tbChitietdiadanhtourDAL ctDAL = new tbChitietdiadanhtourDAL();
            ctDAL.Delete(iD);
        }
        public static tbCTdiadanhtoutCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbChitietdiadanhtourDAL ctDAL = new tbChitietdiadanhtourDAL();
            return ctDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbCTdiadanhtoutCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbChitietdiadanhtourDAL ctDAL = new tbChitietdiadanhtourDAL();
            return ctDAL.Get(cri.Criter, 0, 0, tbCTdiadanhtourCollumn.mactdiadanhtour.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbChitietdiadanhtour GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbCTdiadanhtourCollumn.mactdiadanhtour.ToString(), Condition.EQUAL, iD);
            tbChitietdiadanhtourDAL ctDAL = new tbChitietdiadanhtourDAL();
            tbCTdiadanhtoutCollection ctColl = ctDAL.Get(cri.Criter, 0, 0, tbCTdiadanhtourCollumn.mactdiadanhtour.ToString(), OrderDirection.ASC.ToString(), out total);
            if (ctColl.Count > 0)
                return ctColl[0];
            return null;
        }
        public static tbCTdiadanhtoutCollection GetLimited(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbChitietdiadanhtourDAL ctDAL = new tbChitietdiadanhtourDAL();
            return ctDAL.Get(cri.Criter, 1, number,
            tbCTdiadanhtourCollumn.mactdiadanhtour.ToString(), OrderDirection.DESC.ToString(), out total);
        }
        public static tbCTdiadanhtoutCollection GetPromotion(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbChitietdiadanhtourDAL ctDAL = new tbChitietdiadanhtourDAL();
            return ctDAL.Get(cri.Criter, 1, number,
            tbCTdiadanhtourCollumn.mactdiadanhtour.ToString(), OrderDirection.DESC.ToString(), out total);
        }
    }
}
